<?php

class Logger {
	const ERROR_LEVEL=1;
	const WARNING_LEVEL=2;
	const NOTICE_LEVEL=3;
	const DEBUG_LEVEL=4;
	private static $_loggers=array();
	
	private $_logLevel=Logger::DEBUG_LEVEL;
	/**
	 * Enter description here...
	 *
	 * @param unknown_type $name
	 * @return Logger
	 */
	public static function getLogger($name){
		if (!isset(self::$_loggers[$name])){
			self::$_loggers[$name] = new Logger();
		}
		return self::$_loggers[$name];
	}
	
	private function __construct(){
		
	}
	
	public function setLevel($newLevel){
		$this->_logLevel = $newLevel;
	}
	public function log($text,$level=4){
		if ($level<=$this->_logLevel){
			echo date_format(new DateTime(),"h:m:s"). "Log :: ".$text."<br />\n";
		}
	}
	
}

?>